package competition;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 * @author ZhanBo
 * @date 2020/7/25
 */
public class Main2 {

    public static void method(int [] array){
        Arrays.sort(array);
        StringBuffer stringBuffer =new StringBuffer();
        HashSet<Integer> set = new HashSet<>();
        for (int item : array){
            if (!set.contains(item)){
                set.add(item);
                stringBuffer.append(item+" ");
            }
        }
        System.out.println(set.size());
        System.out.println(stringBuffer.substring(0,stringBuffer.length()-1));
    }

    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        while (scanner.hasNext()){
            int n = scanner.nextInt();
            int [] array = new int[n];
            for (int i =0 ; i<n;i++){
                array[i] =scanner.nextInt();
            }
            method(array);
        }
    }
}
